
#include "OneButton.h"

#define KEY 6
#define BUZZER_PIN 40

OneButton button(KEY, true);
void click();

void setup()
{
    button.reset();
    button.attachLongPressStart(click);
    Serial.begin(115200);
}

void loop()
{
    /* Always call this function in the loop for EasyBuzzer to work. */
    button.tick();
    delay(10);
    pinMode(BUZZER_PIN, OUTPUT);
}

void click()
{

    for (uint8_t i = 0; i < 255; i++)
    {
        digitalWrite(BUZZER_PIN, HIGH);
        delayMicroseconds(125);
        digitalWrite(BUZZER_PIN, LOW);
        delayMicroseconds(125);
    }
    Serial.println("Beep");
}
